#ifndef _ML_DATA_SET_H_
#define _ML_DATA_SET_H_

#include "MLCommon.h"
#include "MLDataPoint.h"
_MYLABLIB_BEGIN

// Data Set
class CMLDataSet
{
public:
	// Constructor and Destructor
	CMLDataSet();
	CMLDataSet(const CMLDataSet& src);
	~CMLDataSet();

public:
	// Methods
	inline int GetNumFields() const { return (int)m_vFieldNames.size(); };
	inline int SetNumFields(int nCount) { m_vFieldNames.resize((size_t)nCount); };
	inline int SetFieldName(int nIndex, const std::wstring& wstrName) { m_vFieldNames[nIndex] = wstrName; };
	
	inline const CMLDataPoint& Get(int nIndex) const { return m_vDataPoints[nIndex]; };
	inline void Set(int nIndex, const CMLDataPoint& dataPoint) { m_vDataPoints[nIndex] = dataPoint; };

	inline void Insert(const CMLDataPoint& dataPoint) { m_vDataPoints.push_back(dataPoint); };
	inline void Insert(const CMLDataSet& dataSet) { m_vDataPoints.insert(m_vDataPoints.end()-1, dataSet.m_vDataPoints.begin(), dataSet.m_vDataPoints.end()); };
	inline void Delete(int nIndex) { m_vDataPoints.erase(m_vDataPoints.begin() + nIndex); };
	inline void Delete(int nBegin, int nCount) { m_vDataPoints.erase(m_vDataPoints.begin()+nBegin, m_vDataPoints.begin()+(nBegin+nCount)); };
	inline void Clear() { m_vDataPoints.clear(); };
	inline int  Count() const { return (int)m_vDataPoints.size(); };
	inline void Resize(int nSize) { m_vDataPoints.resize((size_t)nSize); };
	inline void Reserve(int nCapacity) { m_vDataPoints.resize((size_t)nCapacity); };
	inline bool IsEmpty() const { return Count() == 0; };

	inline CMLDataSet& operator=(const CMLDataSet& src)
	{
		m_vFieldNames = src.m_vFieldNames;
		m_vDataPoints = src.m_vDataPoints;
		return *this;
	}

private:
	// Fields
	std::vector<std::wstring> m_vFieldNames;
	std::vector<CMLDataPoint> m_vDataPoints;
};

_MYLABLIB_END
#endif
